package com.task.manager.mapper;

import com.task.manager.domain.ActionLog;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface ActionLogMapper {
	@Delete({ "delete from t_action_log", "where ID = #{id,jdbcType=INTEGER}" })
	int deleteByPrimaryKey(Integer id);

	@Insert({ "insert into t_action_log (ID, OPERATOR, ", "OPERATE_TIME, ACTION)", "values (#{id,jdbcType=INTEGER}, #{operator,jdbcType=VARCHAR}, ",
			"#{operateTime,jdbcType=TIMESTAMP}, #{action,jdbcType=LONGVARCHAR})" })
	int insert(ActionLog record);

	@InsertProvider(type = ActionLogSqlProvider.class, method = "insertSelective")
	int insertSelective(ActionLog record);

	@Select({ "select", "ID, OPERATOR, OPERATE_TIME, ACTION", "from t_action_log", "where ID = #{id,jdbcType=INTEGER}" })
	@Results({ @Result(column = "ID", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "OPERATOR", property = "operator", jdbcType = JdbcType.VARCHAR),
			@Result(column = "OPERATE_TIME", property = "operateTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "ACTION", property = "action", jdbcType = JdbcType.LONGVARCHAR) })
	ActionLog selectByPrimaryKey(Integer id);

	@UpdateProvider(type = ActionLogSqlProvider.class, method = "updateByPrimaryKeySelective")
	int updateByPrimaryKeySelective(ActionLog record);

	@Update({ "update t_action_log", "set OPERATOR = #{operator,jdbcType=VARCHAR},", "OPERATE_TIME = #{operateTime,jdbcType=TIMESTAMP},", "ACTION = #{action,jdbcType=LONGVARCHAR}",
			"where ID = #{id,jdbcType=INTEGER}" })
	int updateByPrimaryKeyWithBLOBs(ActionLog record);

	@Update({ "update t_action_log", "set OPERATOR = #{operator,jdbcType=VARCHAR},", "OPERATE_TIME = #{operateTime,jdbcType=TIMESTAMP}", "where ID = #{id,jdbcType=INTEGER}" })
	int updateByPrimaryKey(ActionLog record);
}